/**
 *
 */
Ext.define('Admin.view.waterOptimum.resultshow.waterArea',{
	extend:'Ext.panel.Panel',
	xtype:'woWaterArea',
	//起别名
	alias:'woWaterArea',
	require:[],
	user:[],
	userCLs:'big-100 small-100',
	layout: {
        type: 'hbox',
        align: 'stretch'
    },
	items: [{
		xtype: 'image',
		region: 'center',
    	src: 'resources/images/wateroptimum/fhwater.png',
    	height: 700,
    	flex:1
	},{
		xtype: 'grid',
		store: {xtype:'store',groupField: 'index1'},
		border: true,
		flex: 1,
		margin: '0 0 0 20',
		features: [{
	        ftype: 'summary'
	    }],
		columns: [
			{ text: '水资源区', dataIndex: 'index1', minWidth: 100, width:'31%', align: 'center', summaryType: 'count', summaryRenderer: function(value, summaryData, dataIndex) {
                return '<span style="font-weight:bold;">合计</span>';
            } },
			{ text: '需水量(亿m³)', dataIndex: 'index3', minWidth: 100, width:'17%', align: 'center', renderer:
				function customRound(value, record){
					if(value == null)return null;
					return Ext.util.Format.round(value, 3);
				}, summaryType: 'sum', summaryRenderer: function(value, summaryData, dataIndex) {
	                return '<span style="font-weight:bold;">'+Ext.util.Format.round(value, 3)+'</span>';
	            }
			},
			{ text: '供水量(亿m³)', dataIndex: 'index4', minWidth: 100, width:'17%', align: 'center', renderer:
					function customRound(value, record){
						if(value == null)return null;
						return Ext.util.Format.round(value, 3);
					}, summaryType: 'sum', summaryRenderer: function(value, summaryData, dataIndex) {
		                return '<span style="font-weight:bold;">'+Ext.util.Format.round(value, 3)+'</span>';
		            }
			},
			{ text: '缺水量(亿m³)', dataIndex: 'index5', minWidth: 100, width:'17%', align: 'center', renderer:
					function customRound(value, record){
						if(value == null)return null;
						return Ext.util.Format.round(value, 3);
					}, summaryType: 'sum', summaryRenderer: function(value, summaryData, dataIndex) {
		                return '<span style="font-weight:bold;">'+Ext.util.Format.round(value, 3)+'</span>';
		            }
			},
			{ text: '缺水率', dataIndex: 'index6', minWidth: 100, width:'17%', align: 'center', renderer:
					function customRound(value, record){
						if(value == null)return null;
						return Ext.util.Format.round(value, 3);
					}, summaryType: 'count', summaryRenderer: function(value, summaryData, dataIndex) {
						var data = new Array();
						for(var key in summaryData){
							data.push(summaryData[key]);
						}
		                return '<span style="font-weight:bold;">'+(data[3]/data[1])+'</span>';
		            }
			}
		]
	}],
	getStore: function(){
		return this.query('grid')[0].getStore();
	},
	displayData: function(data){
		this.getStore().setData(data);
	}
});
